/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.mortbay.jetty.pico.dao.item;

import java.util.List;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;

import org.mortbay.jetty.pico.entities.Item;

/**
 *
 * @author Hnmtuan
 */
public class ItemDAOImpl implements ItemDAO {

    @Inject
    private Session session;

    public Session getSession() {
        return session;
    }

    public void setSession(Session session) {
        this.session = session;
    }

    public Item getItemByID(String IdItem) {
        return (Item) session.getNamedQuery("Item.findByIdItem").setString("idItem", IdItem).uniqueResult();
    }

    public List<Item> getList() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Item find(String id) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void save(Item t) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void remove(Item t) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void removeByID(String o) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public List<Item> getItemsByCategory(String IdCate) {
        return session.getNamedQuery("Item.findByCategory").setString("category", IdCate).list();
    }
}
